class StarUI extends DateTimerUI {
    private minutesOfDay = 24 * 60;
    private rad1 = Math.PI/180;
    private sun: egret.Bitmap;
    private moon: egret.Bitmap;
    
    protected createView():void {
      this.sun = this.createBitmapByName("imglist.sun");
      this.sun.x = - 300; // hide
      this.addChild(this.sun);
      this.moon = this.createBitmapByName("imglist.moon");
      this.moon.x = - 300; // hide
      this.addChild(this.moon);      
    }

    protected timeUpdate(timer:DateTimer){
      var minutesNow = timer.hour * 60 + timer.minute;
      
      var angleNow = 270 - 360 * minutesNow / this.minutesOfDay;
      
      this.moveStar(this.sun, this.rad1 * angleNow);
      this.moveStar(this.moon, this.rad1 * (angleNow + 180));
      
    }    
    
    private moveStar(what:egret.Bitmap, rad:number){
      var stageH = this.stage.stageHeight,
          stageWHalf = this.stage.stageWidth / 2;
      what.y = stageH - stageH * Math.sin(rad);
      what.x = stageWHalf + stageWHalf * Math.cos(rad) - 50; // 50为图片width/2
    }
}